package com.woniuxy.common.mapper;

import com.woniuxy.common.entity.MarketTalk;
import com.woniuxy.common.entity.MarketTalkExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MarketTalkMapper {
    long countByExample(MarketTalkExample example);

    int deleteByExample(MarketTalkExample example);

    int deleteByPrimaryKey(String id);

    int insert(MarketTalk record);

    int insertSelective(MarketTalk record);

    List<MarketTalk> selectByExample(MarketTalkExample example);

    MarketTalk selectByPrimaryKey(String id);

    int updateByExampleSelective(@Param("record") MarketTalk record, @Param("example") MarketTalkExample example);

    int updateByExample(@Param("record") MarketTalk record, @Param("example") MarketTalkExample example);

    int updateByPrimaryKeySelective(MarketTalk record);

    int updateByPrimaryKey(MarketTalk record);

    @Select("select * from market_talk where " +
            "(commodity_id=#{commodityid} and receiveuser_id=#{loginuserid} and senduser_id=#{userid}) " +
            "OR (commodity_id=#{commodityid} and receiveuser_id=#{userid} and senduser_id=#{loginuserid}) " +
            "ORDER BY date ASC;")
    List<MarketTalk> selectAllTalksByInfo(
            @Param("loginuserid") String loginuserid,
            @Param("commodityid") String commodityid,
            @Param("userid") String userid);
}
